
const childProcess=require('child_process')
const  fs =require("fs");
const path = require('path');
function startModule(config,startName,rootPath){

    let apackPath=path.join(__dirname,'../../../../');
    let data =rootPath;
    if(startName){
        data+=","+startName;
    }

    fs.writeFile(path.join(apackPath,'/tmp/pack.tmp'), data, function (err) {
        if (err) {
            console.log(err);
        } else {
            let comm="";
            if(apackPath.indexOf(":") != -1 ){
                comm =  apackPath.substr(0,rootPath.indexOf(":")+1)
            }
            comm+=  "&& cd " + apackPath + " && node  com/1110111011101110/apack/pack/packStart.js";
            childProcess.exec(comm)
        }
    });

}


module.exports = startModule;